function a(router,k) {    //权限和路由
    return router.map(item => {
        if (k >= item.role || k==item.max) {  //如果权限大于路由 或者是限定路由
            item.routes &&      //如果存在子路由
            (item.routes = a(item.routes))
            return item  //返回权限大于路由的数据变成一个数组
            
        }
    }).filter(item=>item)   //map返回值特性 需要过滤
}



const RouterDatas = [
    {
        path: "/admin/homes",
        name: "首页",

        component: '@/pages/Admin/Home',
        role: 1,
    },
    {
        path: '/admin/users',
        name: '用户管理',
        component: '@/pages/Layout/Outlet',
        role: 4,

        routes: [
            {
                path: '/admin/users/list',
                name: '用户列表',
               
                component: '@/pages/User/userList',
                role: 4,
            },
            {
                path: '/admin/users/data',
                name: '用户分析',
              
                component: '@/pages/User/userEchars',
                role: 4,
            },
        ]
    },
    {
        path: '/admin/role',
        name: '权限管理',
        component: '@/pages/Layout/Outlet',  // 只加载子路由
        role: 4,
        routes: [
            {
                path: '/admin/role/list',
                name: '权限列表',

                component: '@/pages/Role/RoleList',
                role: 4,
            },
            {
                path: '/admin/role/data',
                name: '权限分析',

                component: '@/pages/Role/RoleData',
                role: 4,
            },
        ]
    },
    {
        path:'/admin/guanggao',
        name:'广告管理',

        component:"@/pages/Layout/Outlet",
        role:4,

        routes:[
            {
                path:'/admin/guanggao/list',
                name:"广告列表",
                component: '@/pages/guanggao/ggList',
                role:4
            },
            {
                path:'/admin/guanggao/add',
                name:"广告添加",
                component: '@/pages/guanggao/ggAdd',
                role:4
            },
        ]
    },
    {
        path: '/admin/inters',
        name: '地图',

        component: '@/pages/Layout/Outlet',  // 只加载子路由
        role: 1,

        routes: [
            {
                path: '/admin/inters/list',
                name: '高德地图',

                component: '@/pages/Inters/AllList',
                role: 1,
            },
            {
                path: '/admin/inters/mylist',
                name: '百度地图',

                component: '@/pages/Inters/MyList',
                role: 1,
            },

        ]
    },
    {
        path: '/admin/anno',
        name: '公告管理',

        component: '@/pages/Layout/Outlet',  // 只加载子路由
        role: 2,

        routes: [
            {
                path: '/admin/anno/list',
                name: '公告列表',

                component: '@/pages/Anno/AnnoList',
                role: 2,
            },
            {
                path: '/admin/anno/add',
                name: '公告新增',

                component: '@/pages/Anno/AnnoAdd',
                role: 2,
            },
            {
                path: '/admin/anno/addType',
                name: '公告类型列表',

                component: '@/pages/Anno/AnnoTypeList',
                role: 2,
            },
        ]
    },
    {
        path: '/admin/advise',
        name: '意见管理',

        component: '@/pages/Layout/Outlet',  // 只加载子路由
        role: 1,
        routes: [
            {
                path: '/admin/advise/list',
                name: '意见列表',

                component: '@/pages/Advise/AdviseList',
                role: 1,
            },
            {
                path: '/admin/advise/add',
                name: '意见新增',

                component: '@/pages/Advise/AdviseAdd',
                role: 1,
            },
            {
                path: '/admin/advise/detail/:id',
                component: '@/pages/Advise/AdviseDetail',
                role: 1,

            },
            {
                path: '/admin/advise/update/:id',
                component: '@/pages/Advise/AdviseUpload',
                role: 1,
            },

        ]
    },
    {
        path: '/admin/offer',
        name: 'offer管理',

        component: '@/pages/Layout/Outlet',  // 只加载子路由
        role: 1,
        routes: [
            {
                path: '/admin/offer/list',

                component: '@/pages/Offer/OfferList',
                role: 1,
            },
            {
                path: '/admin/offer/add',
                name: '新增offer',
                component: '@/pages/Offer/OfferAdd',
                role: 1,
            },
        ]
    },
    {
        path: '/admin/mine',
        name: '个人中心',

        component: '@/pages/Mine/Mine',
        role: 1,
    }


]
console.log(a(RouterDatas,2));

const s = [1,2,3,4,5,6,7,8]
console.log(s.map(item=>{
    if(item>5){
        return item
    }
}));